mui.ready(function() {
	window.onscroll = function() {
		var ht = document.documentElement.scrollTop || document.body.scrollTop;
		if (ht > 137) {
			document.querySelector(".banner").style.position = "fixed";
			document.querySelector(".banner").style.top = "1.25rem";
		} else {
			document.querySelector(".banner").style.position = "static";
		}
		//		吸顶效果,在6plus上会出现细微数据不准的bug
	}

	document.querySelector('.show').addEventListener('tap', function() {
		mui.openWindow({
			url: 'business_cont.html',
		});
	});
	var num = 1;
	mui.ajax('/api/v1/shop/list', {
		data: {
			paramStr: "{userName:" + sessionStorage.userName + ",token:" + sessionStorage.token + ",page:" + num + "}"
		},
		dataType: 'json',
		type: 'post',
		success: function(data) {
			if (data.code == 200) {
				var obj = eval('(' + data.data + ')');
				var show = document.querySelector(".show")
				var i;
				show.innerHTML = "";
				for (i in obj.shop_list) {
					var dl = document.createElement("dl");
					show.appendChild(dl);
					
					var dd = document.createElement("dd");
					dd.innerHTML = obj.shop_list[i].merchantName;
					dl.appendChild(dd);
					
					var dt = document.createElement("dt");
					dl.appendChild(dt);
					
					var img = document.createElement("img");
					img.src = obj.shop_list[i].imgCover;
					dt.appendChild(img);
				}
			}
		},
		error: function(xhr, type, errorThrown) {
			//异常处理；
			alert("未知错误")
		}
	});
	//轮播
		var gallery = mui('.mui-slider');
		gallery.slider({
			interval: 2000 //自动轮播周期，若为0则不自动播放，默认为0；
		});
})